package com.meeruu.sg.account.core.domain.component.thread;

/**
 * @Auther: liwu
 * @Date: 2019/5/6 13:52
 * @Description:
 */
public class ExecutorRunnable implements Runnable{


    private ThreadBizInvoke threadBizInvoke;

    private ExecutionReject executionReject;

    public ExecutorRunnable(ThreadBizInvoke threadBizInvoke, ExecutionReject executionReject) {

        this.threadBizInvoke = threadBizInvoke;
        this.executionReject = executionReject;

    }

    @Override
    public void run() {

        threadBizInvoke.invoke();
    }

    public void rejectedExecution() {

        if(executionReject!=null){
            executionReject.rejected();
        }
    }
}
